<?php
require_once '../libs/app.config.php';
session_start();
if($_SESSION['LoginId'] == false){
	header("Location:login.php");
}
//单项删除
if($_POST['delid'])
{
  $sql="delete from admin_user where id='".$_POST['delid']."'";
  $query=$tpm->query($sql);
  if($query>0)
  echo "1";
  else
  echo "0";
}
//管理员列表
$sql="select au.id,au.admin_name,au.admin_email,au.add_time,au.last_login,au.last_ip,ag.group_name from admin_user au left join admin_group ag on au.group_id=ag.id";
$query=$tpm->query($sql);
while($rows=$tpm->fetch_array($query))
{

$admin_list[]=array('id'=>$rows['id'],
				  'admin_name'=>$rows['admin_name'],
				  'admin_email'=>$rows['admin_email'],
				  'add_time'=>$rows['add_time'],
				  'last_login'=>$rows['last_login'],
				  'last_ip'=>$rows['last_ip'],
				  'group_name'=>$rows['group_name']
				 );
}
require_once(INCLUDE_PATH.'template.inc.php');  //模板类及对象$tpl的加载
$tpl->assign("admin_list",$admin_list);
$tpl->display("admin_list.html");
?>